<!--<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>

    <script src="http://door-market/jquery-1.11.1.min.js"></script>
    <script src="http://door-market/admin/admin.js"></script>
    <link rel="stylesheet" type="text/css" href="http://door-market/admin/login.css">
    <link rel="stylesheet" type="text/css" href="http://door-market/admin/admin.css">
</head>
-->
<?php

define('SMARTY_DIR', 'C:/xampp/htdocs/door-market/Smarty-3.1.19/libs/');
require_once('C:/xampp/htdocs/door-market/php/classes/Login.class.php');

require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();


$smarty->template_dir = 'C:/xampp/htdocs/door-market/admin/template/';
$smarty->compile_dir  = 'C:/xampp/htdocs/door-market/admin/template_c';
//$smarty->config_dir   = '/web/www.example.com/guestbook/configs/';
//$smarty->cache_dir    = '/web/www.example.com/guestbook/cache/';

$desplay_error='none';
$error_description = 'no error';

session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from Form

    $user_name = $_POST['username'];

    $user_pass = $_POST['password'];

    $login = new Login();

// If result matched $myusername and $mypassword, table row must be 1 row
    if ($login->login($user_name,$user_pass) == 1) {

        $_SESSION['login_user'] = $user_name;

        header("location: admin.html");
    } else {
        $error = "Ви ввели не привильний логін чи пароль.<br>Спробуйте ще раз.<br>";
    }

    $desplay_error='inline';
    $error_description = $error;
}

$smarty->assign('error_description',$error_description);
$smarty->assign('desplay_error',$desplay_error);

//** un-comment the following line to show the debug console
//$smarty->debugging = true;

$smarty->display('login.tpl');
?>

<!--
<div class="center_form">
    <div class="login_logo">
        <img src="http://door-market/img/logo.jpg" alt="Smiley face">
    </div>
    <div class="login_title">
        Для входу введіть логін та пароль
    </div>


    <div class="login_form">

        <form class="log_form" action="" method="post">

            <p>
                <input type="text" class="user_name" placeholder="Username" name="username"/><br/>
            </p>

            <p>
                <input type="password" class="user_pass" placeholder="Password" name="password"/><br/>
            </p>

            <div class="wrong_data" style="display: inline;">
                Імя користвача не може бути пустим.
            </div>
            <input type="submit" value=" Submit "/><br/>

        </form>

    </div>


</div>


</html>
-->